//
//  CinemaTableViewCell.m
//  Mtime
//
//  Created by Mac on 15/8/5.
//  Copyright (c) 2015年 wxk. All rights reserved.
//

#import "CinemaTableViewCell.h"

@implementation CinemaTableViewCell

- (void)awakeFromNib {
    // Initialization code
}

- (void)setModel:(CinemaModel *)model {

    _model = model;
    
    _name.text = model.cinameName;
    
    _price.text = [NSString stringWithFormat:@"¥%.1f",[model.minPrice floatValue]/100];
    
    _address.text = model.address;
    
    /*
     {
     "has3D": 1,
     "hasIMAX": 0,
     "hasVIP": 0,
     "hasPark": 1,
     "hasServiceTicket": 1,
     "hasWifi": 0,
     "hasLoveseat": 0,
     "hasFeature4K": 0,
     "hasFeatureDolby": 0,
     "hasFeatureHuge": 0,
     "hasFeature4D": 0
     }
     */

    int i = 0;
    if ([[model.feature objectForKey:@"has3D"] isEqual:@0]) {
        i = i +1;
        _image1.hidden = YES;
    }
    
    _image2.transform = CGAffineTransformMakeTranslation(- i*40, 0);
    if ([[model.feature objectForKey:@"hasIMAX"] isEqual:@0]) {
        i = i +1;
        _image2.hidden = YES;
    }

    _image3.transform = CGAffineTransformMakeTranslation(- i*40, 0);
    if ([[model.feature objectForKey:@"hasVIP"] isEqual:@0]) {
        i = i +1;
        _image3.hidden = YES;
    }
    
    _image4.transform = CGAffineTransformMakeTranslation(- i*40, 0);
    if ([[model.feature objectForKey:@"hasPark"] isEqual:@0]) {
        i = i +1;
        _image4.hidden = YES;
    }

    _image5.transform = CGAffineTransformMakeTranslation(- i*40, 0);
    if ([[model.feature objectForKey:@"hasServiceTicket"] isEqual:@0]) {
        i = i +1;
        _image5.hidden = YES;
    }

    _image6.transform = CGAffineTransformMakeTranslation(- i*40, 0);
    
    if ([[model.feature objectForKey:@"hasWifi"] isEqual:@0]) {
        i = i +1;
        _image6.hidden = YES;
    }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
